<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //ES5
        //动物对象，作为dog的原型对象
        var animal={name:"动物"};

        var dog1={color:"黑色"};
        //dog.__proto__=animal 设置dog对象的原型为animal对象
        Object.setPrototypeOf(dog1,animal);
        console.log(dog1);

        //ES6
        var dog2={color:"黑色",__proto__:animal};  //等价Object.setPrototypeOf(dog1,animal);
        console.log(dog2);
    </script>
</body>
</html>